package db.prob.io;

import java.math.BigDecimal;

public class PTuple {

	private String tableName;
	private float probability;
	private String[] attr;
	
	public PTuple(String tableName, float probability, String... attr) {
		super();
		this.tableName = tableName;
		this.probability = probability;
		this.attr = attr;
	}

	public String getTableName() {
		return tableName;
	}

	public float getProbability() {
		return probability;
	}

	public String[] getAttr() {
		return attr;
	}

	@Override
	public String toString() {
		BigDecimal prod = new BigDecimal(this.probability);
		StringBuilder sb = new StringBuilder();
		sb.append(this.tableName).append('\t');
		sb.append(prod.setScale(3, BigDecimal.ROUND_HALF_UP));
		//sb.append(String.format("%.2f", prod));
		for (String attr : this.attr) {
			sb.append('\t').append(attr);
		}
		
		return sb.toString();
	}
	
	
	
}
